﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VectorPointDll;

namespace SmallERP.Bll.CutBoard
{
    public class Machine : IDisposable  
    {
         private bool _disposed;

        // The stream passed to the constructor 
        // must be readable and not null.
        public Machine()
        {
            _disposed = false;
        }

        // Demonstrates using the resource.

        /// <summary>
        /// 裁切大板
        /// </summary>
        /// <param name="PointString"></param>
        /// <param name="CoordinateString"></param>
        /// <param name="RotatePrint"></param>
        /// <returns></returns>
        public string VectorPointToMachine(string PointString, string CoordinateString, bool RotatePrint)
        {
            if (_disposed)
                throw new ObjectDisposedException("Resource was disposed.");
            string result = string.Empty;
            ClassVectorPointClass vec = new ClassVectorPointClass();
            result = vec.VectorPointToMachine(PointString, CoordinateString, RotatePrint);
            return result;
        }

        /// <summary>
        /// 判断机器是否忙
        /// </summary>
        /// <returns></returns>
        public bool isMachineBusy()
        {
            if (_disposed)
                throw new ObjectDisposedException("Resource was disposed.");
            ClassVectorPointClass vec = new ClassVectorPointClass();
            return vec.isMachineBusy();
        }

        public void Dispose() 
        {
            Dispose(true);

            // Use SupressFinalize in case a subclass
            // of this type implements a finalizer.
            GC.SuppressFinalize(this);      
        }

        protected virtual void Dispose(bool disposing)
        {
        // If you need thread safety, use a lock around these 
        // operations, as well as in your methods that use the resource.
            if (!_disposed)
            {
                _disposed = true;   
            }
        }

    }
}
